import { http } from "@/utils/http";
import type { HttpResult } from "@/utils/http/types";

export function addFormBatch(params: object) {
  return http.request<HttpResult>("post", "/esflow/form/insert/batch", {
    data: params
  });
}

export function addForm(params: object) {
  return http.request<HttpResult>("post", "/esflow/form/insert", {
    data: params
  });
}

export function deleteForm(ids: string) {
  return http.request<HttpResult>("post", `/esflow/form/delete/${ids}`);
}

export function updateFormBatch(params: object) {
  return http.request<HttpResult>("post", "/esflow/form/update/batch", {
    data: params
  });
}

export function updateForm(params: object) {
  return http.request<HttpResult>("post", "/esflow/form/update", {
    data: params
  });
}

export function savePublish(params: object) {
  return http.request<HttpResult>("post", "/esflow/form/insert/publish", {
    data: params
  });
}

export function queryFormTable(params: object) {
  return http.request<HttpResult>("get", "/esflow/form/get/table", {
    params: params
  });
}

export function getObj(id: string) {
  return http.request<HttpResult>("get", `/esflow/form/get/${id}`);
}

export function getLibrary(id: string) {
  return http.request<HttpResult>("get", `/esflow/form/get/library/${id}`);
}

export function queryFormItemList(id: string) {
  return http.request<HttpResult>("get", `/esflow/form/get/item/list/${id}`);
}
